package com.ipad.net;

import android.os.Handler;

import io.reactivex.Flowable;
import io.reactivex.FlowableSubscriber;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;

/**
 * Created by Administrator on 2018/12/3.
 */

public class BasePresenter<T extends IBaseView> {
    public T t;
    Handler handler = new Handler();

    public void addSubscribe(Flowable flowable, FlowableSubscriber flowableSubscriber) {
        flowable.subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(flowableSubscriber);
    }

    public void post(Runnable runnable) {
        handler.post(runnable);
    }


    public void attchView(T view) {
        t = view;
    }
}
